/**
 * 
 */
package com.yishuki.bluewhale;

import java.util.HashMap;
import java.util.Map;

/**
 * error code and error message , all of error message should from here ,because we 
 * need to handle multi-language 
 * @author yhzhu
 *
 */
public class ErrorCodeMsg {
	/**
	 * Error code and error message for English
	 */
	private static Map<Integer, String>mapErrMsgEn = new HashMap<Integer, String>();
	
	public static int MISS_REQIRED_FIELD = 101;
	public static int DB_ERROR = 201;
	public static int LOGIN_FAILED = 202;
	public static int USER_LOCKED = 203;
	
	
	static{
		mapErrMsgEn.put(MISS_REQIRED_FIELD, "miss some required fileds, please check again");
		mapErrMsgEn.put(DB_ERROR, "DB error");
		mapErrMsgEn.put(LOGIN_FAILED, "invalid user name or password");
		mapErrMsgEn.put(USER_LOCKED, "user has been locked, try again later");
	}
	/**
	 * 
	 * @return error code and error message for default language
	 */
	public static Map<Integer, String> getErrMsgMap(){
		return mapErrMsgEn;
	}
	/**
	 * return error code and error message for specify language;
	 * @param lt
	 * @return
	 */
	public static Map<Integer, String> getErrMsgMap(LanguageType lt){
		return mapErrMsgEn;
	}
	/**
	 * get  error message for default language
	 * @param code
	 * @return 
	 */
	public static String getErrMsg(int code){
		return mapErrMsgEn.get(code);
	}
}
